package com.yanqu.road.server.cmd.player;


import com.yanqu.road.entity.interactive.InteractiveRecord;
import com.yanqu.road.logic.pb.PlayerBasePb;
import com.yanqu.road.pb.player.PlayerProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.player.InteractiveModule;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;
import com.yanqu.road.server.command.Cmd;

import java.util.List;


@Cmd(code = Protocol.S_INTERACTIVE_RECORD, desc = "交互记录")
public class InteractiveRecordCmd extends AbstractCommand {

	private List<InteractiveRecord> interactiveRecordList;

	@Override
	public boolean parseData(YanQuMessage packet) throws Exception {
		return true;
	}

	@Override
	public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
		interactiveRecordList = player.getModule(InteractiveModule.class).getInteractiveRecordList();
	}

	@Override
	public void sendData(GamePlayer player) {
		PlayerProto.InteractiveRecordListMsg.Builder respMsg = PlayerBasePb.parseInteractiveRecordListMsg(interactiveRecordList);
		player.sendPacket(Protocol.U_INTERACTIVE_RECORD, respMsg);
	}
}
